home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / util4 / bytmrk20.lha / bdoc.txt next >
Text File  |  1995-11-03  |  85KB  |  1,700 lines

  1.  
  2. BYTEmark
  3.  
  4.     This is release 2 of BYTE Magazine's BYTEmark benchmark program
  5. (previously known as BYTE's Native Mode Benchmarks). This document covers the
  6. Native Mode (a.k.a. Algorithm Level) tests; benchmarks designed to expose the
  7. capabilities of a system's CPU, FPU, and memory system. Another group of
  8. benchmarks within the BYTEmark suite includes the Application Simulation
  9. Benchmarks. They are detailed in a separate document. [NOTE: The
  10. documentation for the Application simulation benchmarks should appear before
  11. the end of March, 95. -- RG].
  12.  
  13. The Tests
  14.  
  15.     The Native Mode portion of the BYTEmark consists of a number of
  16. well-known algorithms; some BYTE has used before in earlier versions of the
  17. benchmark, others are new. The complete suite consists of 10 tests:
  18.  
  19. · Numeric sort - Sorts an array of 32-bit integers.
  20. · String sort - Sorts an array of strings of arbitrary length.
  21. · Bitfield - Executes a variety of bit manipulation functions.
  22. · Emulated floating-point - A small software floating-point package.
  23. · Fourier coefficients - A numerical analysis routine for calculating series
  24. approximations of waveforms.
  25. · Assignment algorithm - A well-known task allocation algorithm.
  26. · Huffman compression - A well-known text and graphics compression algorithm.
  27. · IDEA encryption - A relatively new block cipher algorithm.
  28. · Neural Net - A small but functional back-propagation network simulator.
  29. · LU Decomposition - A robust algorithm for solving linear equations.
  30.  
  31. A more complete description of each test can be found in later sections of
  32. this document.
  33.  
  34.  
  35.     BYTE built the BYTEmark with the multiplatform world foremost in mind.
  36. There were, of course, other considerations that we kept high on the list:
  37.  
  38. · Real-world algorithms. The algorithms should actually do something.
  39. Previous benchmarks often moved gobs of bytes from one point to another,
  40. added or subtracted piles and piles of numbers, or (in some cases) actually
  41. executed NOP instructions. We should not belittle those tests of yesterday,
  42. they had their place. However, we think it better that tests be based on
  43. activities that are more complex in nature.
  44.  
  45. · Easy to port. All the benchmarks are written in "vanilla" ANSI C. This
  46. provides us with the best chance of moving them quickly and accurately to new
  47. processors and operating systems as they appear. It also simplifies
  48. maintenance.
  49.  
  50.     This means that as new 64-bit (and, perhaps, 128-bit) processors appear,
  51. the benchmarks can test them as soon as a compiler is available.
  52.  
  53. · Comprehensive. The algorithms were derived from a variety of sources. Some
  54. are routines that BYTE had been using for some time. Others are routines
  55. derived from well-known texts in the computer science world. Furthermore, the
  56. algorithms differ in structure. Some simply "walk" sequentially through
  57. one-dimensional arrays. Others build and manipulate two-dimensional arrays.
  58. Finally, some benchmarks are "integer" tests, while others exercise the
  59. floating-point coprocessor (if one is available).
  60.  
  61. · Scalable. We wanted these benchmarks to be useful across as wide a variety
  62. of systems as possible. We also wanted to give them a lifetime beyond the
  63. next wave of new processors.
  64.  
  65.     To that end, we incorporated "dynamic workload adjustment." A complete
  66. description of this appears in a later section. In a nutshell, this allows
  67. the tests to "expand or contract" depending on the capabilities of the system
  68. under test, all the while providing consistent results so that fair and
  69. accurate comparisons are possible.
  70.  
  71. Honesty In Advertising
  72.  
  73.     We'd be lying if we said that the BYTEmark was all the benchmarking that
  74. anyone would ever need to run on a system. It would be equally inaccurate to
  75. suggest that the tests are completely free of inadequacies. There are many
  76. things the tests do not do, there are shortcomings, and there are problems.
  77.     BYTE will continue to improve the BYTEmark. The source code is freely
  78. available, and we encourage vendors and users to examine the routines and
  79. provide us with their feedback. In this way, we assure fairness,
  80. comprehensiveness, and accuracy.
  81.     
  82.     Still, as we mentioned, there are some shortcomings. Here are those
  83. we consider the most significant. Keep them in mind as you examine the
  84. results of the benchmarks now and in the future.
  85.  
  86. · At the mercy of C compilers. Being written in ANSI C, the benchmark program
  87. is highly portable. This is a reflection of the "world we live in." If this
  88. were a one-processor world, we might stand a chance at hand-crafting a
  89. benchmark in assembly language. (At one time, that's exactly what BYTE did.)
  90. Not today, no way.
  91.     The upshot is that the benchmarks must be compiled. For
  92. broadest coverage, we selected ANSI C. And when they're compiled, the
  93. resulting executable's performance can be highly dependent on the
  94. capabilities of the C compiler. Today's benchmark results can be blown out of
  95. the water tomorrow if someone new enters the scene with an optimizing
  96. strategy that outperforms existing competition.
  97.         This concern is not easily waved off. It will require you to keep
  98. careful track of compiler version and optimization switches. As BYTE builds
  99. its database of benchmark results, version number and switch setting will
  100. become an integral part of that data. This will be true for published
  101. information as well, so that you can make comparisons fairly and accurately.
  102. BYTE will control the distribution of test results so that all relevant
  103. compiler information is attached to the data.
  104.         As a faint justification -- for those who think this situation
  105. results in "polluted" tests -- we should point out that we are in the same
  106. boat as all the other developers (at least, all those using C compilers --
  107. and that's quite a sizeable group). If the only C compilers for a given
  108. system happen to be poor ones, everyone suffers. It's a fact that a given
  109. platform's ultimate potential depends as much on the development software
  110. available as on the technical achievements of the hardware design.
  111.  
  112. · It's just CPU and FPU. It's very tempting to try to capture the performance
  113. of a machine in a single number. That has never been possible -- though it's
  114. been tried a lot -- and the gap between that ideal and reality will forever
  115. widen.
  116.         These benchmarks are meant to expose the theoretical upper limit of
  117. the CPU, FPU, and memory architecture of a system. They cannot measure video,
  118. disk, or network throughput (those are the domains of a different set of
  119. benchmarks). You should, therefore, use the results of these tests as part,
  120. not all, of any evaluation of a system.
  121.  
  122. · Single threaded. Currently, each benchmark test uses only a single
  123. execution thread. It's unlikely that you'll find any modern operating system
  124. that does not have some multitasking component. How a system "scales" as more
  125. tasks are run simultaneously is an effect that the current benchmarks cannot
  126. explore.
  127.         BYTE is working on a future version of the tests that will solve this
  128. problem.
  129.  
  130. · The tests are synthetic. This quite reasonable argument is based on the
  131. fact that people don't run benchmarks for a living, they run applications.
  132. Consequently, the only true measure of a system is how well it performs
  133. whatever applications you will be running. This, in fact, is the philosophy
  134. behind the BAPCo benchmarks.
  135.     This is not a point with which we would disagree. BYTE regularly
  136. makes use of a variety of application benchmarks. None of this suggests,
  137. however, that the BYTEmark benchmarks serve no purpose.
  138.     BYTEmark's results should be used as predictors. They can be moved to
  139. a new platform long before native applications will be ported. The BYTEmark
  140. benchmarks will therefore provide an early look at the potential of the
  141. machine. Additionally, the BYTEmark permits you to "home in" on an aspect of
  142. the overall architecture. How well does the system perform when executing
  143. floating-point computations? Does its memory architecture help or hinder the
  144. management of memory buffers that may fall on arbitrary address boundaries?
  145. How does the cache work with a program whose memory access favors moving
  146. randomly through memory as opposed to moving sequentially through memory?
  147.     The answers to these questions can give you a good idea of how well a
  148. system would support a particular class of applications. Only a synthetic
  149. benchmark can give the narrow view necessary to find the answers.
  150.  
  151. Dynamic Workloads
  152.  
  153.     Our long history of benchmarking has taught us one thing above all
  154. others: Tomorrow's system will go faster than today's by an amount exceeding
  155. your wildest guess -- and then some. Dealing with this can become an unending
  156. race.
  157.     It goes like this: You design a benchmark algorithm, you specify its
  158. parameters (how big the array is, how many loops, etc.), you run it on
  159. today's latest super-microcomputer, collect your data, and go home. A new
  160. machine arrives the next day, you run your benchmark, and discover that the
  161. test executes so quickly that the resolution of the clock routine you're
  162. using can't keep up with it (i.e., the test is over and done before the
  163. system clock even has a chance to tick).
  164.     If you modify your routine, the figures you collected yesterday are no
  165. good. If you create a better clock routine by sneaking down into the system
  166. hardware, you can kiss portability goodbye.
  167.  
  168.     The BYTEmark benchmarks solve this problem by a process we'll refer to as
  169. "dynamic workload adjustment." In principle, it simply means that if the test
  170. runs so fast that the system clock can't time it, the benchmark increases the
  171. test workload -- and keeps increasing it -- until enough time is consumed to
  172. gather reliable test results.
  173.     Here's an example.
  174.     The BYTEmark benchmarks perform timing using a "stopwatch" paradigm. The
  175. routine StartStopwatch() begins timing; StopStopwatch() ends timing and
  176. reports the elapsed time in clock ticks. Now, "clock ticks" is a value that
  177. varies from system to system. We'll presume that our test system provides
  178. 1000 clock ticks per second. (We'll also presume that the system actually
  179. updates its clock 1000 times per second. Surprisingly, some systems don't do
  180. that. One we know of will tell you that the clock provides 100 ticks per
  181. second, but updates the clock in 5- or 6-tick increments. The resolution is
  182. no better than somewhere around 1/18th of a second.) Here, when we say
  183. "system" we mean not only the computer system, but the environment provided
  184. by the C compiler. Interestingly, different C compilers for the same system
  185. will report different clock ticks per second.
  186.     Built into the benchmarks is a global variable called GLOBALMINTICKS.
  187. This variable is the minimum number of clock ticks that the benchmark will
  188. allow StopStopwatch() to report.
  189.     Suppose you run the Numeric Sort benchmark. The benchmark program will
  190. construct an array filled with random numbers, call StartStopwatch(), sort
  191. the array, and call StopStopwatch(). If the time reported in StopStopwatch()
  192. is less than GLOBALMINTICKS, then the benchmark will build two arrays, and
  193. try again. If sorting two arrays took less time than GLOBALMINTICKS, the
  194. process repeats with more arrays.
  195.     This goes on until the benchmark makes enough work so that an interval
  196. between StartStopwatch() and StopStopwatch() exceeds GLOBALMINTICKS. Once
  197. that happens, the test is actually run, and scores are calculated.
  198.     Notice that the benchmark didn't make bigger arrays, it made more arrays.
  199. That's because the time taken by the sort test does not increase linearly as
  200. the array grows, it increases by a factor of N*log(N) (where N is the size of
  201. the array).
  202.     This principle is applied to all the benchmark tests. A machine with a
  203. less accurate clock may be forced to sort more arrays at a time, but the
  204. results are given in arrays per second. In this way fast machines, slow
  205. machines, machines with accurate clocks, machines with less accurate clocks,
  206. can all be tested with the same code.
  207.  
  208. Confidence Intervals
  209.  
  210.     Another built-in feature of the BYTEmark is a set of
  211. statistical-analysis routines. Running benchmarks is one thing; the question
  212. arises as to how many times should a test be run until you know you have a
  213. good sampling. Also, can you determine whether the test is stable (i.e., do
  214. results vary widely from one execution of the benchmark to the next)?
  215.     The BYTEmark keeps score as follows: Each test (a test being a
  216. numeric sort, a string sort, etc.) is run five times. These five scores are
  217. averaged, the standard deviation is determined, and a 95% confidence
  218. half-interval for the mean is calculated. This tells us that the true average
  219. lies -- with a 95% probability -- within plus or minus the confidence
  220. half-interval of the calculated average. If this half-interval is within 5%
  221. of the calculated average, the benchmarking stops. Otherwise, a new test is
  222. run and the calculations are repeated.
  223.     The upshot is that, for each benchmark test, the true average is --
  224. with a 95% level of confidence -- within 5% of the average reported. Here,
  225. the "true average" is the average we would get were we able to run the tests
  226. over and over again an infinite number of times.
  227.     This specification ensures that the calculation of results is
  228. controlled; that someone running the tests in California will use the same
  229. technique for determining benchmark results as someone running the tests in
  230. New York.
  231.  
  232. Interpreting Results
  233.  
  234. Of course, running the benchmarks can present you with a boatload of data. It
  235. can get mystifying, and some of the more esoteric statistical information is
  236. valuable only to a limited audience. The big question is: What does it all
  237. mean?
  238.     First, we should point out that the BYTEmark reports both "raw" and
  239. indexed scores for each test. The raw score for a particular test amounts to
  240. the "iterations per second" of that test. For example, the numeric sort test
  241. reports as its raw score the number of arrays it was able to sort per second.
  242.     The indexed score is the raw score of the system under test divided
  243. by the raw score obtained on the baseline machine. As of this release, the
  244. baseline machine is a DELL 90 Mhz Pentium XPS/90 with 16 MB of RAM and 256K
  245. of external processor cache. (The compiler used was the Watcom C/C++ 10.0
  246. compiler; optimizations set to "fastest possible code", 4-byte structure
  247. alignment, Pentium code generation with Pentium register-based calling.) The
  248. indexed score serves to "normalize" the raw scores, reducing their dynamic
  249. range and making them easier to grasp. Simply put, if your machine has an
  250. index score of 2.0 on the numeric sort test, it performed that test twice as
  251. fast as a 90 Mhz Pentium.
  252.     If you run all the tests (as you'll see, it is possible to perform
  253. "custom runs", which execute only a subset of the tests) the BYTEmark will
  254. also produce two overall index figures: Integer index and Floating-point
  255. index. The Integer index is the geometric mean of those tests that involve
  256. only integer processing -- numeric sort, string sort, bitfield, emulated
  257. floating-point, assignment, Huffman, and IDEA -- while the Floating-point
  258. index is the geometric mean of those tests that require the floating-point
  259. comprocessor -- Fourier, neural net, and LU decomposition. You can use these
  260. scores to get a general feel for the performance of the machine under test as
  261. compared to the baseline 90 Mhz Pentium.
  262.     What follows is a list of the benchmarks and associated brief remarks
  263. that describe what the tests do: What they exercise; what a "good" result or
  264. a "bad" result means. Keep in mind that, in this expanding universe of faster
  265. processors, bigger caches, more elaborate memory architectures, "good" and
  266. "bad" are indeed relative terms. A good score on today's hot new processor
  267. will be a bad score on tomorrow's hot new processor.
  268.     These remarks are based on empirical data and profiling that we have
  269. done to date. (NOTE: The profiling is limited to Intel and Motorola 68K on
  270. this release. As more data is gathered, we will be refining this section.
  271. 3/14/95--RG)
  272.  
  273. Benchmark        Description
  274. Numeric sort    Generic integer performance. Should exercise non-sequential
  275.         performance of cache (or memory if cache is less than 8K).
  276.         Moves 32-bit longs at a time, so 16-bit processors will be at
  277.         a disadvantage.
  278.  
  279. String sort     Tests memory-move performance. Should exercise non-sequential
  280.         performance of cache, with added burden that moves are
  281.         byte-wide and can occur on odd address boundaries. May tax
  282.         the performance of cell-based processors that must perform
  283.         additional shift operations to deal with bytes.
  284.  
  285. Bitfield    Exercises "bit twiddling" performance. Travels through memory
  286.         in a somewhat sequential fashion; different from sorts in
  287.         that data is merely altered in place. If properly compiled,
  288.         takes into account 64-bit processors, which should see a
  289.         boost.
  290.  
  291. Emulated F.P.    Past experience has shown this test to be a good measurement
  292.         of overall performance.
  293.  
  294. Fourier        Good measure of transcendental and trigonometric performance
  295.         of FPU. Little array activity, so this test should not be
  296.         dependent of cache or memory architecture.
  297.  
  298. Assignment    The test moves through large integer arrays in both row-wise
  299.         and column-wise fashion. Cache/memory with good sequential
  300.         performance should see a boost (memory is altered in place --
  301.         no moving as in a sort operation). Processing is done in
  302.         32-bit chunks -- no advantage given to 64-bit processors.
  303.  
  304. Huffman        A combination of byte operations, bit twiddling, and overall
  305.         integer manipulation. Should be a good general measurement.
  306.  
  307. IDEA        Moves through data sequentally in 16-bit chunks. Should
  308.         provide a good indication of raw speed.
  309.  
  310. Neural Net    Small-array floating-point test heavily dependent on the
  311.         exponential function; less dependent on overall FPU
  312.         performance. Small arrays, so cache/memory architecture
  313.         should not come into play.
  314.  
  315. LU decomp.    A floating-point test that moves through arrays in both
  316.         row-wise and column-wise fashion. Exercises only fundamental
  317.         math operations (+, -, *, /).
  318.  
  319.  
  320. The Command File
  321.  
  322. Purpose
  323.  
  324.     The BYTEmark program allows you to override many of its default
  325. parameters using a command file. The command file also lets you request
  326. statistical information, as well as specify an output file to hold the test
  327. results for later use.
  328.     You identify the command file using a command-line argument. E.G.,
  329.         C:NBENCH -cCOMFILE.DAT
  330. tells the benchmark program to read from COMFILE.DAT in the current
  331. directory.
  332.  
  333.     The content of the command file is simply a series of parameter names
  334. and values, each on a single line. The parameters control internal variables
  335. that are either global in nature (i.e., they effect all tests in the program)
  336. or are specific to a given benchmark test.
  337.     The parameters are listed in a reference guide that follows, arranged
  338. in the following groups:
  339.         Global Parameters
  340.         Numeric Sort
  341.         String Sort
  342.         Bitfield
  343.         Emulated floating-point
  344.         Fourier coefficients
  345.         Assignment algorithm
  346.         IDEA encryption
  347.         Huffman compression
  348.         Neural net
  349.         LU decomposition
  350. As mentioned above, those items listed under "Global Parameters" affect all
  351. tests; the rest deal with specific benchmarks. There is no required ordering
  352. to parameters as they appear in the command file. You can specify them in any
  353. sequence you wish.
  354.     You should be judicious in your use of a command file. Some
  355. parameters will override the "dynamic workload" adjustment that each test
  356. performs. Doing this completely bypasses the benchmark code that is designed
  357. to produce an accurate reading from your system clock. Other parameters will
  358. alter default settings, yielding test results that cannot be compared with
  359. published benchmark results.
  360.  
  361. A Sample Command File
  362.  
  363.     Suppose you built a command file that contained the following:
  364.  
  365.         ALLSTATS=T
  366.         CUSTOMRUN=T
  367.         OUTFILE=D:\DATA.DAT
  368.         DONUMSORT=T
  369.         DOLU=T
  370.  
  371. Here's what this file tells the benchmark program:
  372.  
  373. · ALLSTATS=T means that you've requested a "dump" of all the statistics the
  374. test gathers. This includes not only the standard deviations of tests run, it
  375. also produces test-specific information such as the number of arrays built,
  376. the array size, etc.
  377. · CUSTOMRUN=T tells the system that this is a custom run. Only tests
  378. explicitly specified will be executed.
  379. · OUTFILE=D:\DATA.DAT will write the output of the benchmark to the file
  380. DATA.DAT on the root of the D: drive. (If DATA.DAT already exists, output
  381. will be appended to the file.)
  382. · DONUMSORT=T tells the system to run the numeric sort benchmark. (This was
  383. necessary on account of the CUSTOMRUN=T line, above.)
  384. · DOLU=T tells the system to run the LU decomposition benchmark.
  385.  
  386. Command File Parameters Reference
  387. (NOTE: Altering some global parameters can invalidate results for comparison
  388. purposes. Those parameters are indicated in the following section by a bold
  389. asterisk (*). If you alter any parameters so indicated, you may NOT publish
  390. the resulting data as BYTEmark scores.)
  391.  
  392.  
  393. Global Parameters
  394.  
  395. GLOBALMINTICKS=<n>
  396. This overrides the default global_min_ticks value (defined in NBENCH1.H). The
  397. global_min_ticks value is defined as the minimum number of clock ticks per
  398. iteration of a particular benchmark. For example, if global_min_ticks is set
  399. to 100 and the numeric sort benchmark is run; each iteration MUST take at
  400. least 100 ticks, or the system will expand the work-per-iteration.
  401.  
  402. MINSECONDS=<n>
  403. Sets the minimum number of seconds any particular test will run. This has the
  404. effect of controlling the number of repetitions done. Default: 5.
  405.  
  406. ALLSTATS=<T|F>
  407. Set this flag to T for a "dump" of all statistics. The information displayed
  408. varies from test to test. Default: F.
  409.  
  410. OUTFILE=<path>
  411. Specifies that output should go to the specified output file. Any test
  412. results and statistical data displayed onscreen will also be written to the
  413. file. If the file does not exist, it will be created; otherwise, new output
  414. will be appended to an existing file. This allows you to "capture" several
  415. runs into a single file for later review. Note: the path should not appear in
  416. quotes. For example, something like the following would work:
  417. OUTFILE=C:\BENCH\DUMP.DAT
  418.  
  419. CUSTOMRUN=<T|F>
  420. Set this flag to T for a custom run. A "custom run" means that the program
  421. will run only the benchmark tests that you explicitly specify. So, use this
  422. flag to run a subset of the tests. Default: F.
  423.  
  424.  
  425. Numeric Sort
  426.  
  427. DONUMSORT=<T|F>
  428. Indicates whether to do the numeric sort. Default is T, unless this is a
  429. custom run (CUSTOMRUN=T), in which case default is F.
  430.  
  431. NUMNUMARRAYS=<n>
  432. Indicates the number of numeric arrays the system will build. Setting this
  433. value will override the program's "dynamic workload" adjustment for this
  434. test.*
  435.  
  436. NUMARRAYSIZE=<n>
  437. Indicates the number of elements in each numeric array. Default is 8001
  438. entries. (NOTE: Altering this value will invalidate the test for comparison
  439. purposes. The performance of the numeric sort test is not related to the
  440. array size as a linear function; i.e., an array twice as big will not take
  441. twice as long. The relationship involves a logarithmic function.)*
  442.  
  443. NUMMINSECONDS=<n>
  444. Overrides MINSECONDS for the numeric sort test.
  445.  
  446.  
  447. String Sort 
  448.  
  449. DOSTRINGSORT=<T|F>
  450. Indicates whether to do the string sort. Default is T, unless this is a
  451. custom run (CUSTOMRUN=T), in which case the default is F.
  452.  
  453. STRARRAYSIZE=<n>
  454. Sets the size of the string array. Default is 8111. (NOTE: Altering this
  455. value will invalidate the test for comparison purposes. The performance of
  456. the string sort test is not related to the array size as a linear function;
  457. i.e., an array twice as big will not take twice as long. The relationship
  458. involves a logarithmic function.)*
  459.  
  460. NUMSTRARRAYS=<n>
  461. Sets the number of string arrays that will be created to run the test.
  462. Setting this value will override the program's "dynamic workload" adjustment
  463. for this test.*
  464.  
  465. STRMINSECONDS=<n>
  466. Overrides MINSECONDS for the string sort test.
  467.  
  468.  
  469. Bitfield
  470.  
  471. DOBITFIELD=<T|F>
  472. Indicates whether to do the bitfield test. Default is T, unless this is a
  473. custom run (CUSTOMRUN=T), in which case the default is F.
  474.  
  475. NUMBITOPS=<n>
  476. Sets the number of bitfield operations that will be performed. Setting this
  477. value will override the program's "dynamic workload" adjustment for this
  478. test.*
  479.  
  480. BITFIELDSIZE=<n>
  481. Sets the number of 32-bit elements in the bitfield arrays. The default value
  482. is dependent on the size of a long as defined by the current compiler. For a
  483. typical compiler that defines a long to be 32 bits, the default is 32768.
  484. (NOTE: Altering this parameter will invalidate test results for comparison
  485. purposes.)*
  486.  
  487. BITMINSECONDS=<n>
  488. Overrides MINSECONDS for the bitfield test.
  489.  
  490.  
  491. Emulated floating-point
  492.  
  493. DOEMF=<T|F>
  494. Indicates whether to do the emulated floating-point test. Default is T,
  495. unless this is a custom run (CUSTOMRUN=T), in which case the default is F.
  496.  
  497. EMFARRAYSIZE=<n>
  498. Sets the size (number of elements) of the emulated floating-point benchmark.
  499. Default is 3000. The test builds three arrays, each of equal size. This
  500. parameter sets the number of elements for EACH array. (NOTE: Altering this
  501. parameter will invalidate test results for comparison purposes.)*
  502.  
  503. EMFLOOPS=<n>
  504. Sets the number of loops per iteration of the floating-point test. Setting
  505. this value will override the program's "dynamic workload" adjustment for this
  506. test.*
  507.  
  508. EMFMINSECONDS=<n>
  509. Overrides MINSECONDS for the emulated floating-point test.
  510.  
  511.  
  512. Fourier coefficients
  513.  
  514. DOFOUR=<T|F>
  515. Indicates whether to do the Fourier test. Default is T, unless this is a
  516. custom run (CUSTOMRUN=T), in which case the default is F.
  517.  
  518. FOURASIZE=<n>
  519. Sets the size of the array for the Fourier test. This sets the number of
  520. coefficients the test will derive. NOTE: Specifying this value will override
  521. the system's "dynamic workload" adjustment for this test, and may make the
  522. results invalid for comparison purposes.*
  523.  
  524. FOURMINSECONDS=<n>
  525. Overrides MINSECONDS for the Fourier test.
  526.  
  527.  
  528. Assignment Algorithm
  529.  
  530. DOASSIGN=<T|F>
  531. Indicates whether to do the assignment algorithm test. Default is T, unless
  532. this is a custom run (CUSTOMRUN=T), in which case the default is F.
  533.  
  534. ASSIGNARRAYS=<n>
  535. Indicates the number of arrays that will be built for the test. Specifying
  536. this value will override the system's "dynamic workload" adjustment for this
  537. test. (NOTE: The size of the arrays in the assignment algorithm is fixed at
  538. 101 x 101. Altering the array size requires adjusting global constants and
  539. recompiling; to do so, however, would invalidate test results.)*
  540.  
  541. ASSIGNMINSECONDS=<n>
  542. Overrides MINSECONDS for the assignment algorithm test.
  543.  
  544.  
  545. IDEA encryption
  546.  
  547. DOIDEA=<T|F>
  548. Indicates whether to do the IDEA encryption test. Default is T, unless this
  549. is a custom run (CUSTOMRUN=T), in which case the default is F.
  550.  
  551. IDEAARRAYSIZE=<n>
  552. Sets the size of the plaintext character array that will be encrypted by the
  553. test. Default is 4000. The benchmark actually builds 3 arrays: 1st plaintext,
  554. encrypted version, and 2nd plaintext. The 2nd plaintext array is the
  555. destination for the decryption process [part of the test]. All arrays are set
  556. to the same size. (NOTE: Specifying this value will invalidate test results
  557. for comparison purposes.)*
  558.  
  559. IDEALOOPS=<n>
  560. Indicates the number of loops in the IDEA test. Specifying this value will
  561. override the system's "dynamic workload" adjustment for this test.*
  562.  
  563. IDEAMINSECONDS=<n>
  564. Overrides MINSECONDS for the IDEA test.
  565.  
  566.  
  567. Huffman compression
  568.  
  569. DOHUFF=<T|F>
  570. Indicates whether to do the Huffman test. Default is T, unless this is a
  571. custom run (CUSTOMRUN=T), in which case the default is F.
  572.  
  573. HUFFARRAYSIZE=<n>
  574. Sets the size of the string buffer that will be compressed using the Huffman
  575. test. The default is 5000. (NOTE: Altering this value will invalidate test
  576. results for comparison purposes.)*
  577.  
  578. HUFFLOOPS=<n>
  579. Sets the number of loops in the Huffman test. Specifying this value will
  580. override the system's "dynamic workload" adjustment for this test.*
  581.  
  582. HUFFMINSECONDS=<n>
  583. Overrides MINSECONDS for the Huffman test.
  584.  
  585.  
  586. Neural net
  587.  
  588. DONNET=<T|F>
  589. Indicates whether to do the Neural Net test. Default is T, unless this is a
  590. custom run (CUSTOMRUN=T), in which case the default is F.
  591.  
  592. NNETLOOPS=<n>
  593. Sets the number of loops in the Neural Net test. NOTE: Altering this value
  594. overrides the benchmark's "dynamic workload" adjustment algorithm, and may
  595. invalidate the results for comparison purposes.*
  596.  
  597. NNETMINSECONDS=<n>
  598. Overrides MINSECONDS for the Neural Net test.
  599.  
  600.  
  601. LU decomposition
  602.  
  603. DOLU=<T|F>
  604. Indicates whether to do the LU decomposition test. Default is T, unless this
  605. is a custom run (CUSTOMRUN=T), in which case the default is F.
  606.  
  607. LUNUMARRAYS=<n>
  608. Sets the number of arrays in each iteration of the LU decomposition test.
  609. Specifying this value will override the system's "dynamic workload"
  610. adjustment for this test.*
  611.  
  612. LUMINSECONDS=<n>
  613. Overrides MINSECONDS for the LU decomposition test.
  614.  
  615.  
  616. Numeric Sort
  617.  
  618. Description
  619.  
  620. This benchmark is designed to explore how well the system sorts a numeric
  621. array. In this case, a numeric array is a one-dimensional collection of
  622. signed, 32-bit integers. The actual sorting is performed by a heapsort
  623. algorithm (see the text box following for a description of the heapsort
  624. algorithm).
  625.     It's probably unnecessary to point out (but we'll do it anyway) that
  626. sorting is a fundamental operation in computer application software. You'll
  627. likely find sorting routines nestled deep inside a variety of applications;
  628. everything from database systems to operating-systems kernels.
  629.     The numeric sort benchmark reports the number of arrays it was able
  630. to sort per second. The array size is set by a global constant (it can be
  631. overridden by the command file -- see below).
  632.  
  633. Analysis
  634.  
  635. Optimized 486 code: Profiling of the numeric sort benchmark using Watcom's
  636. profiler (Watcom C/C++ 10.0) indicates that the algorithm spends most of its
  637. time in the numsift() function (specifically, about 90% of the benchmark's
  638. time takes place in numsift()). Within numsift(), two if statements dominate
  639. time spent:
  640.  
  641.     if(array[k]<array[k+1L])  and  if(array[i]<array[k])
  642.  
  643.     Both statements involve indexes into arrays, so it's likely the
  644. processor is spending a lot of time resolving the array references. (Though
  645. both statements involve "less-than" comparisons, we doubt that much time is
  646. consumed in performing the signed compare operation.) Though the first
  647. statement involves array elements that are adjacent to one another, the
  648. second does not. In fact, the second statement will probably involve elements
  649. that are far apart from one another during early passes through the sifting
  650. process. We expect that systems whose caching system pre-fetches contiguous
  651. elements (often in "burst" line fills) will not have any great advantage of
  652. systems without pre-fetch mechanisms.
  653.     Similar results were found when we profiled the numeric sort
  654. algorithm under the Borland C/C++ compiler.
  655.  
  656.     680x0 Code (Macintosh CodeWarrior): CodeWarrior's profiler is
  657. function based; consequently, it does not allow for line-by-line analysis as
  658. does the Watcom compiler's profiler.
  659.     However, the CodeWarrior profiler does give us enough information to
  660. note that NumSift() only accounts for about 28% of the time consumed by the
  661. benchmark. The outer routine, NumHeapSort() accounts for around 71% of the
  662. time taken. It will require additional analysis to determine why the two
  663. compilers -- Watcom and CodeWarrior divide the workload so differently. (It
  664. may have something to do with compiler architecture, or the act of profiling
  665. the code may produce results that are significantly different than how the
  666. program runs under normal conditions, though that would lead one to wonder
  667. what use profilers would be.)
  668.  
  669. Porting Considerations
  670.  
  671.     The numeric sort routine should represent a trivial porting exercise.
  672. It is not an overly large benchmark in terms of source code. Additionally,
  673. the only external routines it calls on are for allocating and releasing
  674. memory, and managing the stopwatch.
  675.     The numeric sort benchmark depends on the following global
  676. definitions (note that these may be overridden by the command file):
  677.  
  678. NUMNUMARRAYS - Sets the upper limit on the number of arrays that the
  679. benchmark will attempt to build. The numeric sort benchmark creates work for
  680. itself by requiring the system to sort more and more arrays...not bigger and
  681. bigger arrays. (The latter case would skew results, because the sorting time
  682. for heapsort is N log2 N - e.g., doubling the array size does not double the
  683. sort time.) This constant sets the upper limit to the number of arrays the
  684. system will build before it signals an error. The default value is 100, and
  685. may be changed if your system exceeds this limit.
  686.  
  687. NUMARRAYSIZE - Determines the size of each array built. It has been set to
  688. 8111L and should not be tampered with. The command file entry
  689. NUMARRAYSIZE=<n> can be used to change this value, but results produced by
  690. doing this will make your results incompatible with other runs of the
  691. benchmark (since results will be skewed -- see preceding paragraph).
  692.  
  693.     To test for a correct execution of the numeric sort benchmark,
  694. #define the DEBUG symbol. This will enable code that verifies that arrays are
  695. properly sorted. You should run the benchmark program using a command file
  696. that has only the numeric sort test enabled. If there is an error, the
  697. program will display "SORT ERROR." (If this happens, it's possible that tons
  698. of "SORT ERROR" messages will be emitted, so it's best not to redirect output
  699. to a file.)
  700.  
  701. References
  702.  
  703. Gonnet, G.H. 1984, Handbook of Algorithms and Data Structures (Reading, MA:
  704. Addison-Wesley).
  705.  
  706. Knuth, Donald E. 1968, Fundamental Algorithms, vol 1 of The Art of Computer
  707. Programming (Reading, MA: Addison-Wesley).
  708.  
  709. Press, William H., Flannery, Brian P., Teukolsky, Saul A., and Vetterling,
  710. William T. 1989, Numerical Recipes in Pascal (Cambridge: Cambridge University
  711. Press).
  712.  
  713.  
  714. Heapsort
  715.  
  716. The heapsort algorithm is well-covered in a number of the popular
  717. computer-science textbooks. In fact, it gets a pat on the back in Numerical
  718. Recipes (Press et. al.), where the authors write: Heapsort is our favorite
  719. sorting routine. It can be recommended wholeheartedly for a variety of
  720. sorting applications. It is a true "in-place" sort, requiring no auxiliary
  721. storage.
  722.     Heapsort works by building the array into a kind of a queue called a
  723. heap. You can imagine this heap as being a form of in-memory binary tree. The
  724. topmost (root) element of the tree is the element that -- were the array
  725. sorted -- would be the largest element in the array. Sorting takes place by
  726. first constructing the heap, then pulling the root off the tree, promoting
  727. the next largest element to the root, pulling it off, and so on. (The
  728. promotion process is known as "sifting up.")
  729.     Heapsort executes in N log2 N time even in its worst case. Unlike
  730. some other sorting algorithms, it does not benefit from a partially sorted
  731. array (though Gonnet does refer to a variation of heapsort, called
  732. "smoothsort," which does -- see references).
  733.  
  734.  
  735. String Sort
  736.  
  737. Description
  738.  
  739. This benchmark is designed to gauge how well the system moves bytes around.
  740. By that we mean, how well the system can copy a string of bytes from one
  741. location to another; source and destination being aligned to arbitrary
  742. addresses. (This is unlike the numeric sort array, which moves bytes
  743. longword-at-a-time.) The strings themselves are built so as to be of random
  744. length, ranging from no fewer than 4 bytes and no greater than 80 bytes. The
  745. mixture of random lengths means that processors will be forced to deal with
  746. strings that begin and end on arbitrary address boundaries.
  747.     The string sort benchmark uses the heapsort algorithm; this is the
  748. same algorithm as is used in the numeric sort benchmark (see the sidebar on
  749. the heapsort for a detailed description of the algorithm).
  750.     Manipulation of the strings is actually handled by two arrays. One
  751. array holds the strings themselves; the other is a pointers array. Each
  752. member of the pointers array carries an offset that points into the string
  753. array, so that the ith pointer carries the offset to the ith string. This
  754. allows the benchmark to rapidly locate the position of the ith string. (The
  755. sorting algorithm requires exchanges of items that might be "distant" from
  756. one another in the array. It's critical that the routine be able to rapidly
  757. find a string based on its indexed position in the array.)
  758.     The string sort benchmark reports the number of string arrays it was
  759. able to sort per second. The size of the array is set by a global constant.
  760.  
  761. Analysis
  762.  
  763.     Optimized 486 code (Watcom C/C++ 10.0): Profiling of the string sort
  764. benchmark indicates that it spends most of its time in the C library routine
  765. memmove(). Within that routine, most of the execution is consumed by a pair
  766. of instructions: rep movsw and rep movsd. These are repeated string move --
  767. word width and repeated string move -- doubleword width, respectively.
  768.     This is precisely where we want to see the time spent. It's
  769. interesting to note that the memmove() of the particular compiler/profiler
  770. tested (Watcom C/C++ 10.0) was "smart" enough to do most of the moving on
  771. word or doubleword boundaries. The string sort benchmark specifically sets
  772. arbitrary boundaries, so we'd expect to see lots of byte-wide moves. The
  773. "smart" memmove() is able to move bytes only when it has to, and does the
  774. remainder of the work via words and doublewords (which can move more bits at
  775. a time).
  776.  
  777.     680x0 Code (Macintosh CodeWarrior): Because CodeWarrior's profiler is
  778. function based, it is impossible to get an idea of how much time the test
  779. spends in library routines such as memmove(). Fortunately, as an artifact of
  780. the early version of the benchmark, the string sort algorithm makes use of
  781. the MoveMemory() routine in the sysspec.c file (system specific routines).
  782. This call, on anything other than a 16-bit DOS system, calls memmove()
  783. directly. Hence, we can get a good approximation of how much time is spent
  784. moving bytes.
  785.     The answer is that nearly 78% of the benchmark's time is consumed by
  786. MoveMemory(), the rest being taken up by the other routines (the
  787. str_is_less() routine, which performs string comparisons, takes about 7% of
  788. the time). As above, we can guess that most of the benchmark's time is
  789. dependent on the performance of the library's memmove() routine.
  790.  
  791. Porting Considerations
  792.  
  793.     As with the numeric sort routine, the string sort benchmark should be
  794. simple to port. Simpler, in fact. The string sort benchmark routine is not
  795. dependent on any typedef that may change from machine to machine (unless a
  796. char type is not 8 bits).
  797.      The string sort benchmark depends on the following global
  798. definitions:
  799.  
  800. NUMSTRARRAYS - Sets the upper limit on the number of arrays that the
  801. benchmark will attempt to build. The string sort benchmark creates work for
  802. itself by requiring the system to sort more and more arrays, not bigger and
  803. bigger arrays. (See section on Numeric Sort for an explanation.) This
  804. constant sets the upper limit to the number of arrays the system will build
  805. before it signals an error. The default value is 100, and may be changed if
  806. your system exceeds this limit.
  807.  
  808. STRARRAYSIZE - Sets the default size of the string arrays built. We say
  809. "arrays" because, as with the numeric sort benchmark, the system adds work
  810. not by expanding the size of the array, but by adding more arrays. This value
  811. is set to 8111, and should not be modified, since results would not be
  812. comparable with other runs of the same benchmark on other machines.
  813.  
  814.     To test for a correct execution of the string sort benchmark, #define
  815. the DEBUG symbol. This will enable code that verifies the arrays are properly
  816. sorted. Set up a command file that runs only the string sort, and execute the
  817. benchmark program. If the routine is operating properly, the benchmark will
  818. complete with no error messages. Otherwise, the program will display "Sort
  819. Error" for each pair of strings it finds out of order.
  820.  
  821. References
  822.  
  823. See the references for the Numeric Sort benchmark.
  824.  
  825.  
  826. Bitfield Operations
  827.  
  828. Description
  829.  
  830. The purpose of this benchmark is to explore how efficiently the system
  831. executes operations that deal with "twiddling bits." The test is set up to
  832. simulate a "bit map"; a data structure used to keep track of storage usage.
  833. (Don't confuse this meaning of "bitmap" with its use in describing a graphics
  834. data structure.)
  835.     Systems often use bit maps to keep an inventory of memory blocks or
  836. (more frequently) disk blocks. In the case of a bit map that manages disk
  837. usage, an operating system will set aside a buffer in memory so that each bit
  838. in that buffer corresponds to a block on the disk drive. A 0 bit means that
  839. the corresponding block is free; a 1 bit means the block is in use. Whenever
  840. a file requests a new block of disk storage, the operating system searches
  841. the bit map for the first 0 bit, sets the bit (to indicate that the block is
  842. now spoken for), and returns the number of the corresponding disk block to
  843. the requesting file.
  844.     These types of operations are precisely what this test simulates. A
  845. block of memory is set allocated for the bit map. Another block of memory is
  846. allocated, and set up to hold a series of "bit map commands". Each bitmap
  847. command tells the simulation to do 1 of 3 things:
  848.     1) Clear a series of consecutive bits,
  849.     2) Set a series of consecutive bits, or
  850.     3) Complement (1->0 and 0->1) a series of consecutive bits. The bit
  851. map command block is loaded with a set of random bit map commands (each
  852. command covers an random number of bits), and simulation routine steps
  853. sequentially through the command block, grabbing a command and executing it.
  854.     The bitfield benchmark reports the number of bits it was able to
  855. operate on per second. The size of the bit map is constant; the bitfield
  856. operations array is adjusted based on the capabilities of the processor. (See
  857. the section describing the auto-adjust feature of the benchmarks.)
  858.  
  859. Analysis
  860.     Optimized 486 code: Using the Watcom C/C++ 10.0 profiler, the
  861. Bitfield benchmark appears to spend all of its time in two routines:
  862. ToggleBitRun() (74% of the time) and DoBitFieldIteration() (24% of the time).
  863. We say "appears" because this is misleading, as we will explain.
  864.     First, it is important to recall that the test performs one of three
  865. operations for each run of bits (see above). The routine ToggleBitRun()
  866. handles two of those three operations: setting a run of bits and clearing a
  867. run of bits. An if() statement inside ToggleBitRun() decides which of the two
  868. operations is performed. (Speed freaks will quite rightly point out that this
  869. slows the entire algorithm. ToggleBitRun() is called by a switch() statement
  870. which has already decided whether bits should be set or cleared; it's a waste
  871. of time to have ToggleBitRun() have to make that decision yet again.)
  872.     DoBitFieldIteration() is the "outer" routine that calls
  873. ToggleBitRun(). DoBitFieldIteration() also calls FlipBitRun(). This latter
  874. routine is the one that performs the third bitfield operation: complementing
  875. a run of bits. FlipBitRun() gets no "air time" at all (while
  876. DoBitFieldIteration() gets 24 % of the time) simply because the compiler's
  877. optimizer recognizes that FlipBitRun() is only called by
  878. DoBitFieldIteration(), and is called only once. Consequently, the optimizer
  879. moves FlipBitRun() "inline", i.e., into DoBitFieldIteration(). This removes
  880. an unnecessary call/return cycle (and is probably part of the reason why the
  881. FlipBitRun() code gets 24% of the algorithm's time, instead of something
  882. closer to 30% of its time.)
  883.     Within the routines, those lines of code that actually do the
  884. shifting, the and operations, and the or operations, consume time evenly.
  885. This should make for a good test of a processor's "bit twiddling"
  886. capabilities.
  887.  
  888.     680x0 Code (Macintosh CodeWarrior): The CodeWarrior profiler is
  889. function based. Consequently, it is impossible to produce a profile of
  890. machine instruction execution time. We can, however, get a good picture of
  891. how the algorithm divides its time among the various functions.
  892.     Unlike the 486 compiler, the CodeWarrior compiler did not appear to
  893. collapse the FlipBitRun() routine into the outer DoBitFieldIteration()
  894. routine. (We don't know this for certain, of course. It's possible that the
  895. compiler would have done this had we not been profiling.)
  896.     In any case, the time spent in the two "core" routines of the
  897. bitfield test are shown below:
  898.     FlipBitRun() - 18031.2 microsecs (called 509 times)
  899.     ToggleBitRun() - 50770.6 microsecs (called 1031 times) In terms of
  900. total time, FlipBitRun() takes about 35% of the time (it gets about 33% of
  901. the calls). Remember, ToggleBitRun() is a single routine that is called both
  902. to set and clear bits. Hence, ToggleBitRun() is called twice as often as
  903. FlipBitRun().
  904.     We can conclude that time spent setting bits to 1, seting bits to 0,
  905. and changing the state of bits, is about equal; the load is balanced close to
  906. what we'd expect it to be, based on the structure of the algorithm.
  907.  
  908. Porting Considerations
  909.  
  910.     The bitfield operations benchmark is dependent on the size of the
  911. long datatype. On most systems, this is 32 bits. However, on some of the
  912. newer RISC chips, a long can be 64 bits long. If your system does use 64-bit
  913. longs, you'll need to #define the symbol LONG64.
  914.     If you are unsure of the size of a long in your system (some C
  915. compiler manuals make it difficult to discover), simply place an ALLSTATS=T
  916. line in the command file and run the benchmarks. This will cause the
  917. benchmark program to display (among other things) the size of the data types
  918. int, short, and long in bytes.
  919.  
  920. BITFARRAYSIZE - Sets the number of longs in the bit map array. This number is
  921. fixed, and should not be altered. The bitfield test adjusts itself by adding
  922. more bitfield commands (see above), not by creating a larger bit map.
  923.  
  924.     Currently, there is no code added to test for correct execution. If
  925. you are concerned that your port was incorrect, you'll need to step through
  926. your favorite debugger and verify execution against the original source code.
  927.  
  928. References
  929.  
  930. None.
  931.  
  932.  
  933. Emulated Floating-point
  934.  
  935. Description
  936.  
  937.     The emulated floating-point benchmark includes routines that are similar to
  938. those that would be executed whenever a system performs floating-point
  939. operations in the absence of a coprocessor. In general, this amounts to a
  940. mixture of integer instructions, including shift operations, integer addition
  941. and subtraction, and bit testing (among others).
  942.     The benchmark itself is remarkably simple. The test builds three
  943. 1-dimensional arrays and loads the first two up with random floating-point
  944. numbers. The arrays are then partitioned into 4 equal-sized groups, and the
  945. test proceeds by performing addition, subtraction, multiplication, and
  946. division -- one operation on each group. (For example, for the addition
  947. group, an element from the first array is added to the second array and the
  948. result is placed in the third array.)
  949.     Of course, most of the work takes place inside the routines that
  950. perform the addition, subtraction, multiplication, and division. These
  951. routines operate on a special data type (referred to as an InternalFPF
  952. number) that -- though not strictly IEEE compliant -- carries all the
  953. necessary data fields to support an IEEE-compatible floating-point system.
  954. Specifically, an InternalFPF number is built up of the following fields:
  955.     · Type (indicates a NORMAL, SUBNORMAL, etc.)
  956.     · Mantissa sign
  957.     · Unbiased, signed 16-bit exponent
  958.     · 4-word (16 bits) mantissa.
  959.  
  960.     The emulated floating-point test reports its results in number of
  961. loops per second (where a "loop" is one pass through the arrays as described
  962. above).
  963.     Finally, we are aware that this test could be on its way to becoming
  964. an anachronism. A growing number of systems are appearing that have
  965. coprocessors built into the main CPU. It's possible that floating-point
  966. emulation will one day be a thing of the past.
  967.  
  968. Analysis
  969.  
  970.     Optimized 486 code (Watcom C/C++ 10.0): The algorithm's time is
  971. distributed across a number of routines. The distribution is:
  972.     · ShiftMantLeft1() - 60% of the time
  973.     · ShiftMantRight1() - 17% of the time
  974.     · DivideInternalFPF() - 14% of the time
  975.     · MultiplyInternalFPF() - 5% of the time.
  976. The first two routines are similar to one another; both shift bits about in a
  977. floating-point number's mantissa. It's reasonable that ShiftMantLeft1()
  978. should take a larger share of the system's time; it is called as part of the
  979. normalization process that concludes every emulated addition, subtraction,
  980. mutiplication, and division.
  981.  
  982.     680x0 Code (Macintosh CodeWarrior): CodeWarrior's profiler is
  983. function-based; consequently, it isn't possible to get timing at the machine
  984. instruction level. However, the output to CodeWarrior's profiler has provided
  985. insight into the breakdown of time spent in various functions that forces us
  986. to rethink our 486 code analysis.
  987.     Analyzing what goes on inside the emulated floatingpoint tests is a
  988. tough one to call because some of the routines that are part of the test are
  989. called by the function that builds the arrays. Consequently, a quick look at
  990. the profiler's output can be misleading; it's not obvious how much time a
  991. particular routine is spending in the test and how much time that same
  992. routine is spending setting up the test (an operation that does not get
  993. timed).
  994.     Specifically, the routine that loads up the arrays with test data
  995. calls LongToInternalFPF() and DivideInternalFPF(). LongToInternalFPF() makes
  996. one call to normalize() if the number is not a true zero. In turn,
  997. normalize() makes an indeterminate number of calls to ShiftMantLeft1(),
  998. depending on the structure of the mantissa being normalized.
  999.     What's worse, DivideInternalFPF() makes all sorts of calls to all
  1000. kinds of important low-level routines such as Sub16Bits() and
  1001. ShiftMantLeft1(). Untangling the wiring of which routine is being called as
  1002. part of the test, and which is being called as part of the setup could
  1003. probably be done with the computer equivalent of detective work and
  1004. spelunking, but in the interest of time we'll opt for approximation.
  1005.     Here's a breakdown of some of the important routines and their times:
  1006.     AddSubInternalFPF() - 1003.9 microsecs (called 9024 times)
  1007.     MultiplyInternalFPF() - 20143 microsecs (called 5610 times)
  1008.     DivideInternalFPF() - 18820.9 microsecs (called 3366 times). The 3366
  1009. calls to DivideInternalFPF() are timed calls, not setup calls -- the profiler
  1010. at least gives outputs of separate calls made to the same routine, so we can
  1011. determine which call is being made by the benchmark, and which is being made
  1012. by the setup routine. It turns out that the setup routine calls
  1013. DivideInternalFPF() 30,000 times.
  1014.     Notice that though addition/subtraction are called most often,
  1015. multiplication next, then finally division; the time spent in each is the
  1016. reverse. Division takes the most time, then multiplication, finally
  1017. addition/subtraction. (There's probably some universal truth lurking here
  1018. somewhere, but we haven't found it yet.)
  1019.     Other routines, and their breakdown:
  1020.     Add16Bits() - 115.3 microsecs
  1021.     ShiftMantRight1() - 574.2 microsecs
  1022.     Sub16Bits() - 1762 microsecs
  1023.     StickySiftRightMant - 40.4 microsecs
  1024.     ShiftMantLeft1() - 17486.1 microsecs The times for the last three
  1025. routines are suspect, since they are called by DivideInternalFPF(), and a
  1026. large portion of their time could be part of the setup process. This is what
  1027. leads us to question the results obtained in the 486 analysis, since it, too,
  1028. is unable to determine precisely who is calling whom.
  1029.  
  1030.  
  1031. Porting Considerations
  1032.  
  1033.     Earlier versions of this benchmark were extremely sensitive to
  1034. porting; particularly to the "endianism" of the target system. We have tried
  1035. to eliminate many of these problems. The test is nonetheless more "sensitive"
  1036. to porting than most others.
  1037.     Pay close attention to the following defines and typedefs. They can
  1038. be found in the files EMFLOAT.H, NMGLOBAL.H, and NBENCH1.H:
  1039. · u8 - Stands for unsigned, 8-bit. Usually defined to be unsigned char.
  1040. · u16 - Stands for unsigned, 16-bit. Usually defined to be unsigned short.
  1041. · u32 - Stands for unsigned, 32-bit. Usually defined to be unsigned long.
  1042. · INTERNAL_FPF_PRECISION - Indicates the number of elements in the mantissa
  1043. of an InternalFPF number. Should be set to 4.
  1044. The exponent field of an InternalFPF number is of type short. It should be
  1045. set to whatever minimal data type can hold a signed, 16-bit number.
  1046.  
  1047.     Other global definitions you will want to be aware of:
  1048.  
  1049. CPUEMFLOATLOOPMAX - Sets the maximum number of loops the benchmark will
  1050. attempt before flagging an error. Each execution of a loop in the emulated
  1051. floating-point test is "non-destructive," since the test takes factors from
  1052. two arrays, operates on the factors, and places the result in a third array.
  1053. Consequently, the test makes more work for itself by increasing the number of
  1054. times it passes through the arrays (# of loops). If the system exceeds the
  1055. limit set by CPUEMFLOATLOOPMAX, it will signal an error. This value may be
  1056. altered to suit your system; it will not effect the benchmark results (unless
  1057. you reduce it so much the system can never generate enough loops to produce a
  1058. good test run).
  1059.  
  1060. EMFARRAYSIZE - Sets the size of the arrays to be used in the test. This value
  1061. is the number of entries (InternalFPF numbers) per array. Currently, the
  1062. number is fixed at 3000, and should not be altered.
  1063.  
  1064.     Currently, there is no means of testing correct execution of the
  1065. benchmark other than via debugger. There are routines available to decode the
  1066. internal floating point format and print out the numbers, but no formal
  1067. correctness test has been constructed. (This should be available soon. --
  1068. 3/14/95 RG)
  1069.  
  1070. References
  1071.  
  1072. Microprocessor Programming for Computer Hobbyists, Neill Graham, Tab Books,
  1073. Blue Ridge Summit, PA, 1977.
  1074.  
  1075. Apple Numerica Manual, Second edition, Apple Computer, Addison-Wesley
  1076. Publishing Co., Reading, MA, 1988.
  1077.  
  1078.  
  1079. Fourier Series
  1080.  
  1081. Description
  1082.  
  1083. This is a floating-point benchmark designed primarily to exercise the
  1084. trigonometric and transcendental functions of the system. It calculates the
  1085. first n Fourier coefficients of the function (x+1)x on the interval 0,2. In
  1086. this case, the function (x+1)x is being treated as a cyclic waveform with a
  1087. period of 2.
  1088.     The Fourier coefficents, when applied as factors to a properly
  1089. constructed series of sine and cosine functions, allow you to approximate the
  1090. original waveform. (In fact, if you can calculate all the Fourier
  1091. coefficients -- there'll be an infinite number -- you can reconstruct the
  1092. waveform exactly). You have to calculate the coefficients via intergration,
  1093. and the algorithm does this using a simple trapezoidal rule for its numeric
  1094. integration function.
  1095.     The upshot of all this is that it provides an exercise for the
  1096. floating-point routines that calculate sine, cosine, and raising a number to
  1097. a power. There are also some floating-point multiplications, divisions,
  1098. additions, and subtractions mixed in.
  1099.     The benchmark reports its results as the number of coefficients
  1100. calculated per second.
  1101.  
  1102. As an additional note, we should point out that the performance of this
  1103. benchmark is heavily dependent on how well-built the compiler's math library
  1104. is. We have seen at least two cases where recompilation with new (and
  1105. improved!) math libraries have resulted in two-fold and five-fold performance
  1106. improvements. (Apparently, when a compiler gets moved to a new platform, the
  1107. trigonometric and transcendental functions in the math libraries are among
  1108. the last routines to be "hand optimized" for the new platform.) About all we
  1109. can say about this is that whenever you run this test, verify that you have
  1110. the latest and greatest math libraries.
  1111.  
  1112. Analysis
  1113.  
  1114.     Optimized 486 code: The benchmark partitions its time almost evenly
  1115. among the modules pow387, exp386, and trig387; giving between 25% and 28% of
  1116. its time to each. This is based on profiling with the Watcom compiler running
  1117. under Windows NT. These modules hold the routines that handle raising a
  1118. number to a power and performing trigonometric (sine and cosine)
  1119. calculations. For example, within trig387, time was nearly equally divided
  1120. between the routine that calculates sine and the routine that calculates
  1121. cosine.
  1122.     The remaining time (between 17% and 18%) was spent in the balance of
  1123. the test. We noticed that most of that time occurred in the routine
  1124. thefunction(). This is at the heart of the numerical integration routine the
  1125. benchmark uses.
  1126.     Consequently, this benchmark should be a good test of the exponential
  1127. and trigonometric capabilities of a processor. (Note that we recognize that
  1128. the performance also depends on how well the compiler's math library is
  1129. built.)
  1130.  
  1131.     680x0 Code (Macintosh CodeWarrior): The CodeWarrior profiler is
  1132. function based, therefore it is impossible to get performance results for
  1133. individual machine instructions. The CodeWarrior compiler is also unable to
  1134. tell us how much time is spent within a given library routine; we can't see
  1135. how much time gets spent executing the sin(), cos(), or pow() functions
  1136. (which, unfortunately, was the whole idea behind the benchmark).
  1137.     About all we can glean from the results is that thefunction() takes
  1138. about 74% of the time in the test (this is where the heavy math calculations
  1139. take place) while trapezoidintegrate() accounts for about 26% of the time on
  1140. its own.
  1141.  
  1142. Porting Considerations
  1143.  
  1144.     Necessarily, this benchmark is at the mercy of the efficiency of the
  1145. floating-point support provided by whatever compiler you are using. It is
  1146. recommended that, if you are doing the port yourself, you contact the
  1147. designers of the compiler, and discuss with them what optimization switches
  1148. should be set to produce the fastest code. (This sounds simple; usually it's
  1149. not. Some systems let you decide between speed and true IEEE compliance.)
  1150.     As far as global definitions go, this benchmark is happily free of
  1151. them. All the math is done using double data types. We have noticed that, on
  1152. some Unix systems, you must be careful to include the correct math libraries.
  1153. Typically, you'll discover this at link time.
  1154.     To test for correct execution of the benchmark: It's unlikely you'll
  1155. need to do this, since the algorithm is so cut-and-dried. Furthermore, there
  1156. are no explicit provisions made to verify the correctness. You can, however,
  1157. either dip into your favorite debugger, or alter the code to print out the
  1158. contents of the abase (which holds the A[i] terms) and bbase (which holds the
  1159. B[i] terms) arrays as they are being filled (see routine
  1160. DoFPUTransIteration). Run the benchmark with a command file set to execute
  1161. only the Fourier test, and examine the contents of the arrays. The first 4
  1162. elements of each array should be:
  1163.        A[i]               B[i]
  1164.     2.837770756        n/a
  1165.     1.045784473        -1.879103261
  1166.     .2741002242        -1.158835123
  1167.     .0824148217        -.8057591902
  1168.     Note that there is no B[0] coefficient. If the above numbers are in
  1169. the arrays shown, you can feel pretty confident that the benchmark it working
  1170. properly.
  1171.  
  1172. References
  1173.  
  1174. Engineering and Scientific Computations in Pascal, Lawrence P. Huelsman,
  1175. Harper & Row, New York, 1986.
  1176.  
  1177.  
  1178. Assignment Algorithm
  1179.  
  1180. Description
  1181.  
  1182.     This test is built on an algorithm with direct application to the
  1183. business world. The assignment algorithm solves the following problem: Say
  1184. you have X machines and Y jobs. Any of the machines can do any of the jobs;
  1185. however, the machines are sufficiently different that the cost of doing a
  1186. particular job can vary depending what machine does it. Furthermore, the jobs
  1187. are sufficiently different that the cost varies depending on which job a
  1188. given machine does. You therefore construct a matrix; machines are the rows,
  1189. jobs are the columns, and the [i,j] element of the array is the cost of doing
  1190. the jth job on the ith machine. How can you assign the jobs so that the cost
  1191. of completing them all is minimal? (This also assumes that one machine does
  1192. one job.)
  1193.     Did you get that?
  1194.     The assignment algorithm benchmark is largely a test of how well the
  1195. processor handles problems built around array manipulation. It is not a
  1196. floating-point test; the "cost matrix" built by the algorithm is simply a 2D
  1197. array of long integers. This benchmark considers an iteration to be a run of
  1198. the assignment algorithm on a 101 x 101 - element matrix. It reports its
  1199. results in iterations per second.
  1200.     
  1201. Analysis
  1202.  
  1203.     Optimized 486 code (Watcom C/C++ 10.0): There are numerous loops
  1204. within the assignment algorithm. The development system we were using (Watcom
  1205. C/C++ 10.0) appears to have a fine time unrolling many of them. Consequently,
  1206. it is difficult to pin down the execution impact of single lines (as in, for
  1207. example, the numeric sort benchmark).
  1208.     On the level of functions, the benchmark spends around 70% of its
  1209. time in the routine first_assignments(). This is where a) lone zeros in rows
  1210. and columns are found and selected, and b) a choice is made between duplicate
  1211. zeros. Around 23% of the time is spent in the second_assignments() routine
  1212. where (if first_assignments() fails) the matrix is partitioned into smaller
  1213. submatrices.
  1214.     Overall, we did a tally of instruction mix execution. The approximate
  1215. breakdowns are:
  1216.     move - 38%
  1217.     conditional jump - 12%
  1218.     unconditional jump - 11%
  1219.     comparison - 14%
  1220.     math/logical/shift - 24%
  1221.     Many of the move instructions that appeared to consume the most
  1222. amounts of time were referencing items on the local stack frame. This
  1223. required an indirect reference through EBP, plus a constant offset to resolve
  1224. the address.
  1225.  
  1226.     This should be a good exercise of a cache, since operations in the
  1227. first_assignments() routine require both row-wise and column-wise movement
  1228. through the array. Note that the routine could be made more "severe" by
  1229. chancing the assignedtableau[][] array to an array of unsigned char --
  1230. forcing fetches on byte boundaries.
  1231.  
  1232. 680x0 Code (CodeWarrior): The CodeWarrior profiler is function-based.
  1233. Consequently, it's not possible to determine what's going on at the machine
  1234. instruction level. We can, however, get a good idea of how much time the
  1235. algorithm spends in each routine. The important routines are broken down as
  1236. follows:
  1237.     calc_minimum_costs() - approximately 0.3% of the time
  1238.         (250 microsecs)
  1239.     first_assignments() - approximately 79% of the time
  1240.         (96284.6 microsecs)
  1241.     second_assignments() - approximately 19% of the time
  1242.         (22758 microsecs)
  1243. These times are approximate; some time is spent in the Assignment() routine
  1244. itself.
  1245.     These figures are reasonably close to those of the 486, at least in
  1246. terms of the mixture of time spent in a particular routine. Hence, this
  1247. should still be a good test of system cache (as described in the preceding
  1248. section), given the behavior of the first_assignments() routine.
  1249.  
  1250. Porting Considerations
  1251.  
  1252.     The assignment algorithm test is purely an integer benchmark, and
  1253. requires no special data types that might be affected by ports to different
  1254. architectures. There are only two global constants that affect the algorithm:
  1255.  
  1256. ASSIGNROWS and ASSIGNCOLS - These set the size of the assignment array. Both
  1257. are defined to be 101 (so, the array that is benchmarked is a 101 x 101
  1258. -element array of longs). These values should not be altered.
  1259.  
  1260.     To test for correct execution of the benchmark: #define the symbol
  1261. DEBUG, recompile, set up a command file that executes only the assignment
  1262. algorithm, and run the benchmark. (You may want to pipe the output through a
  1263. paging filter, like the more program.) The act of defining DEBUG will enable
  1264. a section of code that displays the assigned columns on a per-row basis. If
  1265. the benchmark is working properly, the first 25 numbers to be displayed
  1266. should be:
  1267.     37 58 95 99 100 66 9 52 4 65 43 23 16 19 62 13 77 10 11 95 4 64 2 76 78
  1268. These are the column choices for each row made by the algorithm. (For
  1269. example, row 0 selects column 37, row 1 selects column 58, etc.) Odds are
  1270. extremely good that, if you see these numbers displayed, the algorithm is
  1271. working correctly.
  1272.  
  1273. References
  1274.  
  1275. Quantitative Decision Making for Business, Gordon, Pressman, and Cohn,
  1276. Prentice-Hall, Englewood Cliffs, NJ, 1990.
  1277.  
  1278. Quantitative Decision Making, Guiseppi A. Forgionne, Wadsworth Publishing
  1279. Co., California, 1986.
  1280.  
  1281.  
  1282. Huffman Compression
  1283.  
  1284. Description
  1285.  
  1286.     This is a compression algorithm that -- while helpful for some time
  1287. as a text compression technique -- has since fallen out of fashion on account
  1288. of the superior performance by algorithms such as LZW compression. It is,
  1289. however, still used in some graphics file formats in one form or another.
  1290.     The benchmark consists of three parts:
  1291.  
  1292.     · Building a "Huffman Tree" (explained below),
  1293.     · Compression, and
  1294.     · Decompression.
  1295.  
  1296.     A "Huffman Tree" is a special data structure that guides the
  1297. compression and decompression processes. If you were to diagram one, it would
  1298. look like a large binary tree (i.e., two branches per each node). Describing
  1299. its function in detail is beyond the scope of this paper (see the references
  1300. for more information). We should, however, point out that the tree is built
  1301. from the "bottom up"; and the procedure for constructing it requires that the
  1302. algorithm scan the uncompressed buffer, building a frequency table for all
  1303. the characters appearing in the buffer. (This version of the Huffman
  1304. algorithm compresses byte-at-a-time, though there's no reason why the same
  1305. principle could not be applied to tokens larger than one byte.)
  1306.     Once the tree is built, text compression is relatively
  1307. straightforward. The algorithm fetches a character from the uncompressed
  1308. buffer, navigates the tree based on the character's value, and produces a bit
  1309. stream that is concatenated to the compressed buffer. Decompression is the
  1310. reverse of that process. (We recognize that we are simplifying the algorithm.
  1311. Again, we recommend you check the references.)
  1312.  
  1313.     The Huffman Compression benchmark considers an iteration to be the
  1314. three operations described above, performed on an uncompressed text buffer of
  1315. 5000 bytes. It reports its results in iterations per second.
  1316.  
  1317. Analysis
  1318.  
  1319.     Optimized 486 code (Watcom C/C++ 10.0): The Huffman compression
  1320. algorithm -- tree building, compression, and decompression -- is written as a
  1321. single, large routine: DoHuffIteration(). All the benchmark's time is spent
  1322. within that routine.
  1323.     Components of DoHuffIteration() that consume the most time are those
  1324. that perform the compression and decompression .
  1325.     The code for performing the compression spends most of its time
  1326. (accounting for about 13%) constructing the bit string for a character that
  1327. is being compressed. It does this by seeking up the tree from a leaf,
  1328. emitting 1's and 0's in the process, until it reaches the root. The stream of
  1329. 1's and 0's are loaded into a character array; the algorithm then walks
  1330. "backward" through the array, setting (or clearing) bits in the compression
  1331. buffer as it goes.
  1332.     Similarly, the decompression portion takes about 12% of the time as
  1333. the algorithm pulls bits out of the compressed buffer -- using them to
  1334. navigate the Huffman tree -- and reconstructs the original text.
  1335.  
  1336.     680x0 Code (Macintosh CodeWarrior): CodeWarrior's profiler is
  1337. function based. Consequently, it's impossible to get performance scores for
  1338. individual machine instructions. Furthermore, as mentioned above, the Huffman
  1339. compression algorithm is written as a monolithic routine. This makes the
  1340. results from the CodeWarrior profiler all the more sparse.
  1341.     We can at least point out that the lowmost routines (GetCompBit() and
  1342. SetCompBit()) that read and write individual bits, though called nearly 13
  1343. million times each, account for only 0.7% and 0.3% of the total time,
  1344. respectively.
  1345.  
  1346. Porting Considerations
  1347.  
  1348.     The Huffman algorithm relies on no special data types. It should port
  1349. readily. Global constants of interest include:
  1350.  
  1351. EXCLUDED - This is a large, positive value. Currently it is set to 32000, and
  1352. should be left alone. Basically, this is a token that the system uses to
  1353. indicate an excluded character (one that does not appear in the plaintext).
  1354. It is set to a ridiculously high value that will never appear in the pointers
  1355. of the tree during normal construction.
  1356.  
  1357. MAXHUFFLOOPS - This is another one of those "governor" constants. The Huffman
  1358. benchmark creates more work for itself by doing multiple
  1359. compression/decompression loops. This constant sets the maximum number of
  1360. loops it will attempt per iteration before it gives up. Currently, it is set
  1361. to 50000. Though it is unlikely you'll ever need to modify this value, you
  1362. can increase it if your machine is too fast for the adjustment algorithm. Do
  1363. not reduce the number.
  1364.  
  1365. HUFFARRAYSIZE - This value sets the size of the plaintext array to be
  1366. compressed. You can override this value with the command file to see how well
  1367. your machine performs for larger or smaller arrays. The subsequent results,
  1368. however, are invalid for comparison with other systems.
  1369.  
  1370.     To test for correct execution of the benchmark: #define the symbol
  1371. DEBUG, recompile, build a command file that executes only the Huffman
  1372. compression algorithm, and run the benchmark. Defining DEBUG will enable a
  1373. section of code that verifies the decompression as it takes place (i.e., the
  1374. routine compares -- character at a time -- the uncompressed data with the
  1375. original plaintext). If there's an error, the program will repeatedly
  1376. display: "Error at textoffset xxx".
  1377.  
  1378. References
  1379.  
  1380. Data Compression: Methods and Theory, James A. Storer, Computer Science
  1381. Press, Rockville, MD, 1988.
  1382.  
  1383. An Introduction to Text Processing, Peter D. Smith, MIT Press, Cambridge, MA,
  1384. 1990.
  1385.  
  1386.  
  1387. IDEA Encryption
  1388.  
  1389. Description
  1390.  
  1391.     This is another benchmark based on a "higher-level" algorithm;
  1392. "higher -level" in the sense that it is more complex than a sort or a search
  1393. operation.
  1394.     Security -- and, therefore, cryptography -- are becoming increasingly
  1395. important issues in the computer realm. It's likely that more and more
  1396. machines will be running routines like the IDEA encryption algorithm. (IDEA
  1397. is an acronym for the International Data Encryption Algorithm.)
  1398.  
  1399.     A good description of the algorithm (and, in fact, the reference we
  1400. used to create the source code for the test) can be found in Bruce Schneier's
  1401. exhaustive exploration of encryption, "Applied Cryptography" (see
  1402. references). To quote Mr. Schneier: "In my opinion, it [IDEA] is the best and
  1403. most secure block algorithm available to the public at this time."
  1404.     IDEA is a symmetrical, block cypher algorithm. Symmetrical means that
  1405. the same routine used to encrypt the data also decrypts the data. A block
  1406. cipher works on the plaintext (the message to be encrypted) in fixed,
  1407. discrete chunks. In the case of IDEA, the algorithm encrypts and decrypts 64
  1408. bits at a time.
  1409.     As pointed out in Schneier's book, there are three operations that
  1410. the IDEA uses to do its work:
  1411.     · XOR (exclusive-or)
  1412.     · Addition modulo 216 (ignoring overflow)
  1413.     · Multiplication modulo 216+1 (ignoring overflow).
  1414.  
  1415.     IDEA requires a key of 128 bits. However, keys and blocks are further
  1416. subdivided into 16-bit chunks, so that any given operation within the IDEA
  1417. encryption is performed on 16-bit quantities. (This is one of the many
  1418. advantages of the algorithm, it is efficient even on 16-bit processors.)
  1419.  
  1420.     The IDEA benchmark considers an "iteration" to be an encryption and
  1421. decryption of a buffer of 4000 bytes. The test actually builds 3 buffers: The
  1422. first to hold the original plaintext, the second to hold the encrypted text,
  1423. and the third to hold the decrypted text (the contents of which should match
  1424. that of the first buffer). It reports its results in iterations per second.
  1425.  
  1426. Analysis
  1427.  
  1428.     Optimized 486 code: The algorithm actually spends most of its time
  1429. (nearly 75%) within the mul() routine, which performs the multiplication
  1430. modulo 216+1. This is a super-simple routine, consisting primarily of if
  1431. statements, shifts, and additions.
  1432.     The remaining time (around 24%) is spent in the balance of the
  1433. cipher_idea() routine. (Note that cipher_idea() calls the mul() routine
  1434. frequently; so, the 24% is comprised of the other lines of cipher_idea()).
  1435. cipher_idea() is littered with simple pointer-fetch-and-increment operations,
  1436. some addition, and some exclusive-or operations.
  1437.     Note that IDEA's exercise of system capabilities probably doesn't
  1438. extend beyond testing simple integer math operations. Since the buffer size
  1439. is set to 4000 bytes, the test will run entirely in processor cache on most
  1440. systems. Even the cache won't get a heavy "internal" workout, since the
  1441. algorithm proceeds sequentially through each buffer from lower to higher
  1442. addresses.
  1443.  
  1444.     680x0 code (Macintosh CodeWarrior): CodeWarrior's profiler is
  1445. function based; consequently, it is impossible to determine execution
  1446. profiles for individual machine instructions. We can, however, get an idea of
  1447. how much time is spent in each routine.
  1448.     As with Huffman compression, the IDEA algorithm is written
  1449. monolithically -- a single, large routine does most of the work. However, a
  1450. special multiplication routine, mul(), is frequently called within each
  1451. encryption/decription iteration (see above).
  1452.     In this instance, the results for the 68K system diverges widely from
  1453. those of the 486 system. The CodeWarrior profiler shows the mul() routine as
  1454. taking only 4% of the total time in the benchmark, even though it is called
  1455. over 20 million times. The outer routine is called 600,000 times, and
  1456. accounts for about 96% of the whole program's entire time.
  1457.  
  1458. Porting Considerations
  1459.  
  1460.     Since IDEA does its work in 16-bit units, it is particularly
  1461. important that u16 be defined to whatever datatype provides an unsigned
  1462. 16-bit integer on the test platform. Usually, unsigned short works for this.
  1463. (You can verify the size of a short by running the benchmarks with a command
  1464. file that includes ALLSTATS=T as one of the commands. This will cause the
  1465. benchmark program to display a message that tells the size of the int, short,
  1466. and long datatypes in bytes.)
  1467.     Also, the mul() routine in IDEA requires the u32 datatype to define
  1468. an unsigned 32-bit integer. In most cases, unsigned long works.
  1469.  
  1470.     To test for correct execution of the benchmark: #define the symbol
  1471. DEBUG, recompile, build a command file that executes only the IDEA algorithm,
  1472. and run the benchmark. Defining DEBUG will enable a section of code that
  1473. compares the original plaintext with the output of the test. (Remember, the
  1474. benchmark performs both encryption and decryption.) If the algorithm has
  1475. failed, the output will not match the input, and you'll see "IDEA Error"
  1476. messages all over your display.
  1477.  
  1478. References
  1479.  
  1480. Applied Cryptography: Protocols, Algorithms, and Source Code in C, Bruce
  1481. Schneier, John Wiley & Sons, Inc., New York, 1994.
  1482.  
  1483.  
  1484. Neural Net
  1485.  
  1486. Description
  1487.  
  1488.     The Neural Net simulation benchmark is based on a simple
  1489. back-propagation neural network presented by Maureen Caudill as part of a
  1490. BYTE article that appeared in the October, 1991 issue (see "Expert Networks"
  1491. in that issue). The network involved is a simple 3-layer (input neurodes,
  1492. middle-layer neurodes, and output neurodes) network that accepts a number of
  1493. 5 x 7 input patterns and produce a single 8-bit output pattern.
  1494.     The test involves sending the network an input pattern that is the 5
  1495. x 7 "image" of a character (1's and 0's -- 1's representing lit pixels, 0's
  1496. representing unlit pixels), and teaching it the 8-bit ASCII code for the
  1497. character.
  1498.     A thorough description of how the back propagation algorithm works is
  1499. beyond the scope of this paper. We recommend you search through the
  1500. references given at the end of this paper, particularly Ms. Caudill's
  1501. article, for detailed discussion. In brief, the benchmark is primarily an
  1502. exercise in floating-point operations, with some frequent use of the exp()
  1503. function. It also performs a great deal of array references, though the
  1504. arrays in use are well under 300 elements each (and less than 100 in most
  1505. cases).
  1506.  
  1507.     The Neural Net benchmark considers an iteration to be a single
  1508. learning cycle. (A "learning cycle" is defined as the time it takes the
  1509. network to be able to associate all input patterns to the correct output
  1510. patterns within a specified tolerance.) It reports its results in iterations
  1511. per second.
  1512.  
  1513. Analysis
  1514.  
  1515.     Optimized 486 code: The forward pass of the network (i.e.,
  1516. calculating outputs from inputs) utilize a sigmoid function. This function
  1517. has, at its heart, a call to the exp() library routine. A small but
  1518. non-negligible amount of time is spent in that function (a little over 5% for
  1519. the 486 system we tested).
  1520.     The learning portion of the network benchmark depends on the
  1521. derivative of the sigmoid function, which turns out to require only
  1522. multiplications and subtractions. Consequently, each learning pass exercises
  1523. only simple floating-point operations.
  1524.     If we divide the time spent in the test into two parts -- forward
  1525. pass and backward pass (the latter being the learning pass) -- then the test
  1526. appears to spend the greatest part of its time in the learning phase. In
  1527. fact, most time is spent in the adjust_mid_wts() routine. This is the part of
  1528. the routine that alters the weights on the middle layer neurodes. (It
  1529. accounts for over 40% of the benchmark's time.)
  1530.  
  1531.     680x0 Code (Macintosh CodeWarrior): Though CodeWarrior's profiler is
  1532. function based, the neural net benchmark is highly modular. We can therefore
  1533. get a good breakdown of routine usage:
  1534.     worst_pass_error() - 304 microsecs (called 4680 times)
  1535.     adjust_mid_wts() - 83277 microsecs (called 46800 times)
  1536.     adjust_out_wts() - 17394 microsecs (called 46800 times)
  1537.     do_mid_error() - 11512 microsecs (called 46800 times)
  1538.     do_out_error() - 3002 microsecs (called 46800 times)
  1539.     do_mid_forward() - 49559 microsecs (called 46800 times)
  1540.     do_out_forward() - 20634 microsecs (called 46800 times)
  1541.  
  1542.     Again, most time was spent in adjust_mid_wts() (as on the 486), accounting
  1543. for almost twice as much time as do_mid_forward().
  1544.  
  1545. Porting Consideration
  1546.  
  1547.     The Neural Net benchmark is not dependent on any special data types.
  1548. There are a number of global variables and arrays that should not be altered
  1549. in any way. Most importantly, the #defines found in NBENCH1.H under the
  1550. Neural Net section should not be changed. These control not only the number
  1551. of neurodes in each layer; they also include constants that govern the
  1552. learning processes.
  1553.     Other globals to be aware of:
  1554.  
  1555. MAXNNETLOOPS - This constant simply sets the upper limit on the number of
  1556. training loops the test will permit per iteration. The Neural Net benchmark
  1557. adjusts its workload by re-teaching itself over and over (each time it begins
  1558. a new training session, the network is "cleared" -- loaded with random
  1559. values). It is unlikely you will ever need to modify this constant.
  1560.  
  1561. inpath - This string pointer is set to the path from which the neural net's
  1562. input data is read. It is currently hardwired to "NNET.DAT". You shouldn't
  1563. have to change this name, unless your filesystem requires directory
  1564. information as part of the path.
  1565.  
  1566.     Note that the Neural Net benchmark is the only test that requires an
  1567. external data file. The contents of the file are listed in an attachment to
  1568. this paper. You should use the attachment to reconstruct the file should it
  1569. become lost or corrupted. Any changes to the file will invalidate the test
  1570. results.
  1571.  
  1572.     To test for correct execution of the benchmark: #define the symbol
  1573. DEBUG, recompile, build a command file that executes only the Neural Net
  1574. test, and run the benchmark. Defining DEBUG will enable a section of code
  1575. that displays how many passes through the learning process were required for
  1576. the net to learn. It should learn in 780 passes.
  1577.  
  1578. References
  1579.  
  1580. "Expert Networks," Maureen Caudill, BYTE Magazine, October, 1991.
  1581.  
  1582. Simulating Neural Networks, Norbert Hoffmann, Verlag Vieweg, Wiesbaden, 1994.
  1583.  
  1584. Signal and Image Processing with Neural Networks, Timothy Masters, John Wiley
  1585. and Sons, New York, 1994.
  1586.  
  1587. Introduction to Neural Networks, Jeannette Stanley, California Scientific
  1588. Software, CA, 1989.
  1589.  
  1590.  
  1591. LU Decomposition
  1592.  
  1593. Description
  1594.  
  1595.     LU Decomposition is an algorithm that can be used as the heart of a
  1596. program for solving linear equations. Suppose you have a matrix A. LU
  1597. Decomposition determines the matrices L and U such that
  1598.         L . U = A
  1599. where L is a lower triangular matrix and U is an upper triangular matrix. (A
  1600. lower triangular matrix has nonzero elements only on the main diagonal and
  1601. below. An upper triangular matrix has nonzero elements only on the main
  1602. diagonal and above.)
  1603.     Without going into the mathematical details too deeply, having the L
  1604. and U matrices makes the solution of linear equations (i.e., equations of the
  1605. form A . x = b) quite easy. It turns out that you can also use LU
  1606. decomposition to determine matrix inverses and determinants.
  1607.  
  1608.     The algorithm used in the benchmarks was derived from Numerical
  1609. Recipes in Pascal (there is a C version of the book, which we did not have on
  1610. hand), a book we heartily recommend to anyone serious about mathematical and
  1611. scientific computing. The authors are approving of LU decomposition as a
  1612. means of solving linear equations, pointing out that their version (which
  1613. makes use of what we would have to call "Crout's method with partial implicit
  1614. pivoting") is a factor of 3 better than one of their Gauss-Jordan routines, a
  1615. factor of 1.5 better than another. They go on to demonstrate the use of LU
  1616. decomposition for iterative improvement of linear equation solutions.
  1617.  
  1618.     The benchmark begins by creating a "solvable" linear system. This is
  1619. easily done by loading up the column vector b with random integers, then
  1620. initializing A with an identity matrix. The equations are then "scrambled" by
  1621. either multiplying a row by a constant, or adding one row to another. The
  1622. scrambled matrices are handed to the LU algorithm.
  1623.     The LU Decomposition benchmark considers a single iteration to be the
  1624. solution of one set of equations (the size of A is fixed at 101 x 101
  1625. elements). It reports its results in iterations per second.
  1626.  
  1627. Analysis
  1628.  
  1629.     Optimized 486 code (Watcom C/C++ 10.0): The entire algorithm consists
  1630. of two parts: the LU decomposition itself, and the back substitution
  1631. algorithm that builds the solution vector. The majority of the algorithm's
  1632. time takes place within the former; the algorithm that builds the L and U
  1633. matrices (this takes place in routine ludcmp()).
  1634.     Within ludcmp(), there are two extremely tight for loops forming the
  1635. heart of Crout's algorithm that consume the majority of the time. The loops
  1636. are "tight" in that they each consist of only one line of code; in both
  1637. cases, the line of code is a "multiply and accumulate" operation (actually,
  1638. it's sort of a multiply and de-accumulate, since the result of the
  1639. multiplication is subtracted, not added).
  1640.     In both cases, the items multiplied are elements from the A array;
  1641. and one factor's row index is varying more rapidly, while another factor's
  1642. column index is varying more rapidly.
  1643.     Note that this is a good overall test of floating-point operations
  1644. within matrices. Most of the math is floating-point; primarily additions,
  1645. subtractions, and multiplications (only a few divisions).
  1646.  
  1647.     680x0 Code (Macintosh CodeWarrior): CodeWarrior's profiler is
  1648. function based. It is therefore impossible to determine execution profiles at
  1649. the machine-code level. The profiler does, however, allow us to determine how
  1650. much time the benchmark spends in each routine. This breakdown is as follows:
  1651.     lusolve() - 3.4 microsecs (about 0% of the time)
  1652.     lubksb() 1198 microsec (about 2% of the time)
  1653.     ludcmp() - 63171 microsec (about 91% of the time) The above
  1654. percentages are for the whole program. Consequently, as a portion of actual
  1655. benchmark time, the amount attributed to each will be slightly larger (though
  1656. the proportions will remain the same).
  1657.     Since ludcmp() performs the actual LU decomposition, this is exactly
  1658. where we'd want the benchmark to spend its time. The lubksb() routine calls
  1659. ludcmp(), using the resulting matrix to "back-solve" the linear equation.
  1660.  
  1661. Porting Considerations
  1662.  
  1663.     The LU Decomposition routine requires no special data types, and is
  1664. immune to byte ordering. It does make use of a typedef (LUdblptr) that
  1665. includes an embedded union; this allows the benchmark to "coerce" a pointer
  1666. to double into a pointer to a 2D array of double. This arrangement has not
  1667. caused problems with the compilers we have tested to date.
  1668.     Other constants and globals to be aware of:
  1669.  
  1670. LUARRAYROWS and LUARRAYCOLS - These constants set the size of the coefficient
  1671. matrix, A. They cannot be altered by command file. In fact, you shouldn't
  1672. alter them at all, or your results will be invalid. Currently, they are both
  1673. set to 101.
  1674.  
  1675. MAXLUARRAYS - This is another "governor" constant. The algorithm performs
  1676. dynamic workload adjustment by building more and more arrays to solve per
  1677. timing round. This sets the maximum upper limit of arrays that it will build.
  1678. Currently, it is set to 1000, which should be more than enough for the
  1679. reasonable future (1000 arrays of 101 x 101 floating-point doubles would
  1680. require somewhere around 80 megabytes of RAM -- and that's not counting the
  1681. column vectors).
  1682.  
  1683.     To test for correct execution of the benchmark: Currently, there is
  1684. no simple technique for doing this. You can, however, either use your
  1685. favorite debugger (or embed a printf() statement) at the conclusion of the
  1686. lubksb() routine. When this routine concludes, the array b will hold the
  1687. solution vector. These items will be stored as floating-point doubles, and
  1688. the first 14 are (with rounding):
  1689.     46 20 23 22 85 86 97 95 8 89 75 67 6 86
  1690. If you find these numbers as the first 14 in the array b[], then you're
  1691. virtually guaranteed that the algorithm is working correctly.
  1692.  
  1693. References
  1694.  
  1695. Numerical Recipes in Pascal: The Art of Scientific Computing, Press,
  1696. Flannery, Teukolsky, Vetterling, Cambridge University Press, New York, 1989.
  1697.  
  1698. 10
  1699. BYTE Native Mode Benchmarks
  1700.